#ifndef GTKMM_TRAY_H
#define GTKMM_TRAY_H

#include <gtkmm.h>
#include <unistd.h>
#include <string>

using namespace std;

/*
 * This class runs the Gtk Statusicon and the general GUI including 
 * desktop notifications.
 */
class Tray : public Gtk::StatusIcon {
	public:
		
		Tray();
		~Tray();
		
		// Should be true if the tray is still running.
		bool active;	

		// Should be true if connected to the network.
		bool connected;

		/*
		 * Sets the Tray's status to "connected". 
		 * Changes the icon to the connectionIcon and 
		 * if previusly disconnected sends a notification.
		 */
		void setConnected();

		/*
		 * Sets the Tray's status to "disconnected". 
		 * Changes the icon to the disconnectIcon and 
		 * if previusly connected sends a notification.
		 */
		void setDisconnected();
		
		/*
		 * Sets the name of the currently connected profile.
		 */
		void setConnection(string profile);

	private:	
		string connectionIcon;
		string disconnectIcon;
		
		// The name of the currently used profile.
		string currentProfile;  
	
		// The main menu the user chooses profiles with.	
		Gtk::Menu *mainMenu;

		// The submenu for profile selection.
		Gtk::Menu *profilesSubMenu;

		// A list of profiles already displayed in the status icon.
		std::vector<std::string> knownProfiles;

		virtual void on_statusicon_popup
			(guint button, guint activate_time);

		virtual void on_statusicon_activated();
		
		void on_exit_click();

		void on_disconnect_click();

		void create_main_menu();

		void create_profiles_menu();

		void on_about_click();

		// Returns true if profile is already in the list of profiles
		// displayed by this tray.
		bool knownProfile(std::string profile);



};
#endif
